package net.sparrow.module;

import net.minecraft.src.EntityClientPlayerMP;
import net.sparrow.Sparrow;
import net.sparrow.cmd.CommandHandler;
import net.sparrow.event.DataField;
import net.sparrow.event.SpEventListener;
import net.sparrow.event.SpTickEvent;
import net.sparrow.util.Util;

public class StepModule extends Module {

	
	@DataField( id = "player.step")
	public Boolean step = false;
	
	@SpEventListener
	public void onTickEvent(SpTickEvent e) {
		if(!Util.inGame()) {
			return;
		}
		EntityClientPlayerMP player = Sparrow.mc().player();
		
		if(player.isCollidedHorizontally && player.onGround && step) {
			player.motionY = 0;
			player.setPosition(player.posX, player.posY + .4, player.posZ);
		}
	}
	
	public CommandHandler loadCommands() {
		return new CommandHandler().withDefaultToggle("player.step");
	}

}
